package com.minimalist.common.entity.basic.vo.dict;

import io.swagger.v3.oas.annotations.media.Schema;
import java.io.Serial;
import java.io.Serializable;
import java.util.List;
import java.util.Objects;

/**
 * @author 11987
 */
@Schema(name = "字典数据实体 - 一般用于下拉框的数据展示或编码转换使用")
public class DictCacheVO implements Serializable{

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(name = "字典key和value实体")
    public static class DictKV{

        @Schema(name = "dictKey", description = "字典key，字典编码", type = "string")
        private String dictKey;

        @Schema(name = "dictValue", description = "字典value，字典编码对应的中文", type = "string")
        private String dictValue;

        @Schema(name = "dictType", description = "字典类型", type = "string")
        private String dictType;

        @Schema(name = "dictClass", description = "字典样式，对应前端Tag组件的type", type = "string")
        private String dictClass;

        public String getDictKey() {
            return dictKey;
        }

        public void setDictKey(String dictKey) {
            this.dictKey = dictKey;
        }

        public String getDictValue() {
            return dictValue;
        }

        public void setDictValue(String dictValue) {
            this.dictValue = dictValue;
        }

        public String getDictType() {
            return dictType;
        }

        public void setDictType(String dictType) {
            this.dictType = dictType;
        }

        public String getDictClass() {
            return dictClass;
        }

        public void setDictClass(String dictClass) {
            this.dictClass = dictClass;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            DictKV dictKV = (DictKV) o;
            return Objects.equals(dictKey, dictKV.dictKey) &&
                   Objects.equals(dictValue, dictKV.dictValue) &&
                   Objects.equals(dictType, dictKV.dictType) &&
                   Objects.equals(dictClass, dictKV.dictClass);
        }

        @Override
        public int hashCode() {
            return Objects.hash(dictKey, dictValue, dictType, dictClass);
        }

        @Override
        public String toString() {
            return "DictKV{" +
                   "dictKey='" + dictKey + '\'' +
                   ", dictValue='" + dictValue + '\'' +
                   ", dictType='" + dictType + '\'' +
                   ", dictClass='" + dictClass + '\'' +
                   '}';
        }
    }

    @Schema(name = "dictType", description = "字典类型", type = "string")
    private String dictType;

    @Schema(name = "dictList", description = "字典列表", type = "array")
    private List<DictKV> dictList;

    public String getDictType() {
        return dictType;
    }

    public void setDictType(String dictType) {
        this.dictType = dictType;
    }

    public List<DictKV> getDictList() {
        return dictList;
    }

    public void setDictList(List<DictKV> dictList) {
        this.dictList = dictList;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        DictCacheVO that = (DictCacheVO) o;
        return Objects.equals(dictType, that.dictType) &&
               Objects.equals(dictList, that.dictList);
    }

    @Override
    public int hashCode() {
        return Objects.hash(dictType, dictList);
    }

    @Override
    public String toString() {
        return "DictCacheVO{" +
               "dictType='" + dictType + '\'' +
               ", dictList=" + dictList +
               '}';
    }
}


